package petertel.pbx.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/enumConf")
public class EnumConf {
	
	public static enum YesNo{
		yes,no
	}
	
	private static List<Item> yesNoItems = new ArrayList<Item>();
	
	static{
		yesNoItems.add(new Item(YesNo.yes.name(),"是"));
		yesNoItems.add(new Item(YesNo.no.name(),"否"));
	}
	
	@RequestMapping(value = "/getYesNoItems")
	@ResponseBody
	public List<Item> getYesNoItems(){
		return yesNoItems;
	}
		
	public static class Item{
		private String value;
		
		private String text;
		
		public Item(String value,String text){
			this.value = value;
			this.text = text;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public String getText() {
			return text;
		}

		public void setText(String text) {
			this.text = text;
		}
		
	}
	
}
